/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.core.domain.partner.action;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import info.peigen.hotpot.business.customer.core.domain.partner.Partner;
import info.peigen.hotpot.business.customer.facade.order.partner.PartnerApplyPermissionOrder;
import info.peigen.hotpot.common.core.order.Order;

import java.util.Set;

/**
 * <b>(PartnerDomainAction)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/5
 */
public class PartnerDomainAction {

    public static void mergePermission(Partner partner, Order order) {
        PartnerApplyPermissionOrder applyPermissionOrder = (PartnerApplyPermissionOrder) order;
        Set<String>                 apiCodesSet          = CollectionUtil.newHashSet(applyPermissionOrder.getEnableApiCodes());
        partner.getPermission().setEnableApiCodes(ListUtil.toList(apiCodesSet));
    }

}
